LoginPanel = {};
--模仿mono脚本的this
local this = LoginPanel;
--模仿mono脚本的this.gameObject,this.transform
local transform;
local gameObject;
local behaviour;

function LoginPanel.New()
    --打开页面
    panelMgr:CreatePanel('Login',nil);
end
--启动事件--
function LoginPanel.Awake(obj)
	logWarn("LoginPanel.Awake");
	gameObject = obj;
    transform = obj.transform;
    behaviour = obj:GetComponent('LuaBehaviour');

    this.InitView();
end

function LoginPanel.InitView()
    local openBtn = transform:Find("Open").gameObject;    
    behaviour:AddClick(openBtn,this.OnOpenClick);
end
function LoginPanel.OnOpenClick()
    resMgr:LoadPrefab("login",{'orc'},this.OnLoadPrefab)
end
function LoginPanel.OnLoadPrefab(objs)
    local prefab=objs[0];

    local go = newObject(prefab);
    go.transform:SetParent(transform,false);
    go.transform.localPosition=Vector3.zero;
end